/**
 * 
 */
package com.mycompany.client.widgets;

import java.util.Map;

import com.mycompany.client.CoralPageFactory;
import com.mycompany.client.model.CalendarBO;
import com.mycompany.client.pages.AddSalesActivityPage;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.Window;

/**
 * @author coral.ma
 *
 */
public class CoralWindow extends Window {
	
	private AddSalesActivityPage page; 
	String pageID;
	Button[] buttons;
	
	public CoralWindow(String pageID, Button... buttons) {
		 this(pageID, 800,280,buttons);
	}
	
	public CoralWindow(String pageID, int width, int height, Button... buttons) {
		setWidth(width);  
        setHeight(height);  
        setTitle("Coral Window");  
        setShowMinimizeButton(false);  
        setIsModal(true);  
        setShowModalMask(true);  
        setAlign(Alignment.CENTER);
        centerInPage();
        this.pageID=pageID;
        this.buttons= buttons;
	}
	
	public void init() {
		page = (AddSalesActivityPage)CoralPageFactory.getPanel(pageID);
        page.setWindow(true);
        page.setWindowButtons(buttons);
        addItem(page.getViewPage());
	}
	
	public void init(CalendarBO bo) {
		page = (AddSalesActivityPage)CoralPageFactory.getPanel(pageID);
        page.setWindow(true);
        page.setWindowButtons(buttons);
        page.setDate(bo.getStartDate(), bo.getEndDate());
        addItem(page.getViewPage());
	}
	
	public Map getValues() {
		return page.getValues();
	}
}
